<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:security="http://www.springframework.org/schema/security"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
						http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
						http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
	
	<!-- 루트 시큐리티 컨텍스트; 스프링 시큐리티를 설정한다. -->
	
	<!-- 스프링 시큐리티 보안 필터링을 위한 설정을 선언한다. -->
	<security:http auto-config="true">
		<security:form-login login-page="/login.do"
			login-processing-url="/login_process.do"
			always-use-default-target="false"
			authentication-failure-url="/login_fail.do"/>
		<security:logout logout-url="/logout.do"/>
	</security:http>
	
	<!-- 인증 매니저를 설정한다. -->
	<security:authentication-manager alias="authenticationManager">
		<security:authentication-provider ref="authenticationProvider">
		</security:authentication-provider>
	</security:authentication-manager>
	
	<!-- DAO Service Provider 클래스를 자동 감지한다. -->
	<context:component-scan base-package="com.nts.visionworks.core.security.service" />
	
	<!-- UserDetailService 의 구현에 대한 Spring Bean 을 선언한다. -->
	<bean id="userDetailsService"
		class="com.nts.visionworks.core.security.service.UserDetailsServiceImplement">
	</bean>
	
	<!-- DAO 인증에 사용될 문자열 Digester를 선언한다. -->
	<bean id="jasyptStringDigest"
		class="org.jasypt.digest.StandardStringDigester">
		<property name="algorithm" value="SHA-512"></property>
		<property name="iterations" value="1000"></property>
	</bean>
	
	<!-- DAO 인증 시 패스워드 크리덴셜 암호화를 위한 인코더를 선언한다. -->
	<bean id="passwordEncoder"
		class="org.jasypt.spring.security3.PasswordEncoder">
		<property name="stringDigester" ref="jasyptStringDigest"></property>
	</bean>
	
	<!-- DAO 를 통한 인증 제공자를 설정한다. -->
	<bean id="authenticationProvider"
		class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
		<property name="userDetailsService" ref="userDetailsService"></property>
		<property name="passwordEncoder" ref="passwordEncoder"></property>
	</bean>
	
	<!-- 인증 처리 이벤트를 위한 리스너를 등록한다. -->
	<bean class="com.nts.visionworks.core.security.listener.BroadcastableAuthenticationEventListener"></bean>
	
</beans>